package decorator

import "fmt"

type Drawer interface {
	Draw() string
}

type Square struct {
}

func (s *Square) Draw() string {
	return "画一个正方形"
}

type AreaDecorator struct {
	drawer Drawer
	area   uint
}

func NewAreaDecorator(drawer Drawer, area uint) *AreaDecorator {
	return &AreaDecorator{drawer: drawer, area: area}
}

func (a *AreaDecorator) Draw() string {
	return fmt.Sprintf("%s，面积为%d平方米", a.drawer.Draw(), a.area)
}

type ColorDecorator struct {
	drawer Drawer
	color  string
}

func NewColorDecorator(drawer Drawer, color string) *ColorDecorator {
	return &ColorDecorator{drawer: drawer, color: color}
}

func (c *ColorDecorator) Draw() string {
	return fmt.Sprintf("%s，颜色为：%s", c.drawer.Draw(), c.color)
}

type BorderDecorator struct {
	drawer Drawer
	border string
}

func NewBorderDecorator(drawer Drawer, border string) *BorderDecorator {
	return &BorderDecorator{drawer: drawer, border: border}
}

func (b *BorderDecorator) Draw() string {
	return fmt.Sprintf("%s，边框为：%s", b.drawer.Draw(), b.border)
}
